home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12103 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: mudskipper.cac.psu.edu!user
  2. From: fcusack@tdx.org (frank.)
  3. Newsgroups: comp.os.linux.misc,comp.lang.c++,gnu.gcc.help
  4. Subject: Re: Help: how do you redirect compile error to a file
  5. Date: Mon, 18 Mar 1996 06:12:43 -0400
  6. Organization: Soylent Green is People!!
  7. Message-ID: <fcusack-1803960612430001@mudskipper.cac.psu.edu>
  8. References: <4igdeo$8tf@news.jhu.edu>
  9. NNTP-Posting-Host: mudskipper.cac.psu.edu
  10.  
  11. In article <4igdeo$8tf@news.jhu.edu>, yuehong@psi.ece.jhu.edu (yuehong) wrote:
  12.  
  13. > I try to use the following command when I compile hello.cpp 
  14. > using gcc on linux:
  15. > g++ hello.cpp >bug
  16.  
  17. Errors go to stderr, the '>' operator only redirects stdout. If you are
  18. using sh/ksh/bash/... then you need 
  19.    
  20.    g++ hello.cpp >bug 2>&1
  21.  
  22. Basically, this tells the shell to redirect output to file descriptor 2
  23. (stderr) to the same place that the output from file descriptor 1 (stdout)
  24. is going to, which in this case is the file named "bug".
  25.  
  26. If you are using csh/tcsh/... then you need
  27.  
  28.    g++ hello.cpp >& bug
  29.  
  30. This tells the shell to redirect both stdout and stderr to the same file, "bug".
  31.  
  32. ~Frank
  33.  - Through the modem, past the router, over the firewall.. nothing but Net -
  34.  -  PGP ID: 1C0F6685 | NCB#56 | Visit me --> http://www.tdx.org/~fcusack/  -
  35.